import 'dart:async';

import 'package:erp/Entity/Product.dart';
import 'package:erp/UI/Pages/BasicInformationManagementPages/ProductManagementPages/AddProductPage.dart';
import 'package:erp/UI/Pages/BasicInformationManagementPages/WareHousePages/WareHousePage.dart';
import 'package:flutter/material.dart';


Future<bool> showProductAddtionalPropertyEditDialog(BuildContext context, AddtionalProperty data) async {

  var nameTextController = TextEditingController(text:  data.key);
  var descriptionTextController = TextEditingController(text:  data.value);


  nameTextController.addListener((){
    data.key = nameTextController.text;
  });
  descriptionTextController.addListener((){
    data.value = descriptionTextController.text;
  });

  return showDialog(context: context, builder: (context) => AlertDialog(
    title: Center(child: Text("قوشۇمچە خاسلىقنى تەھرىرلەڭ")),

    content: Wrap(
      direction: Axis.vertical,
      children: <Widget>[
        Container(
          width: 250.0,
          child: TextField(
            decoration: InputDecoration(
              labelText: "ئىسمى",
              hintText: "ئىسمى"
            ),
            controller: nameTextController,
          ),
        ),
        Container(
          width: 250.0,
          child: TextField(
            decoration: InputDecoration(
                labelText: "قىممىتى",
                hintText: "قىممىتى"
            ),
            controller: descriptionTextController,
          ),
        ),
      ],
    ),
    actions: <Widget>[
      FlatButton(onPressed: (){
        Navigator.of(context).pop(false);
      }, child: Text("بىكار قىلىش")),
      FlatButton(onPressed: (){
        Navigator.of(context).pop(true);
      }, child: Text("جەزىملەشتۈرۈش")),
    ],
  ), barrierDismissible: false);
}

